import {get,post,put,del} from '@/utils/request/axios';

/**
 * 获取菜单列表
 * @param obj
 * @returns {*}
 */
export const listMenu = (obj)=>{
  const url = '/leader/sysMenu/getMenuList';
  return get(url,obj);
}

/**
 * 获取树形菜单列表
 * @param obj
 * @returns {*}
 */
export const treeListMenu = (obj)=>{
  const url = '/leader/sysMenu/getTreeMenuList';
  return get(url,obj);
}

/**
 * 获取当前用户的菜单列表
 * @returns {*}
 */
export const getUserMenuList = ()=>{
  const url = '/leader/sysMenu/getTreeMenuByUser';
  return get(url);
}

/**
 * 新增菜单接口
 * @param obj
 * @returns {*}
 */
export const addMenu = (obj) =>{
  const url = "/leader/sysMenu";
  return post(url,obj);
}

/**
 * 修改菜单信息接口
 * @param obj
 * @returns {*}
 */
export const updateMenu = (id,obj) =>{
  const url = "/leader/sysMenu/"+id;
  return put(url,obj);
}

export const deleteMenu = (id) =>{
  const url = "/leader/sysMenu/"+id;
  return del(url);
}

export const listMenuTreeByRoleId = (id) =>{
  const url = "/leader/sysMenu/listMenuTreeByRoleId/"+id;
  return get(url);
}
